/**
 * 
 */
package com.fangzhu.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;

/**
 * @author fangzhu
 * @date 2016-5-18
 */
public class CanalRecordUtils {

	private static Logger logger = LoggerFactory.getLogger(CanalRecordUtils.class);

	/**
	 * string转CanalRecord
	 * 
	 * @param record
	 * @return
	 */
	public static CanalRecord string2CanalRecord(String record) {
		CanalRecord canalRecord = null;
		try {
			canalRecord = JSON.parseObject(record, CanalRecord.class);
		} catch (Exception e) {
			logger.info("不能转换成CanalRecord类型:" + record);
			return null;
		}
		if (canalRecord == null) {
			logger.info("canalRecord为null:" + record);
			return null;
		}
		return canalRecord;
	}

}
